Getting Started with Raspberry Pi by Matt Richardson and Shawn Wallace

Getting Started with Raspberry Pi by Matt Richardson and Shawn Wallace

Author:Matt Richardson and Shawn Wallace
Language: eng
Format: mobi, epub, pdf
Publisher: Maker Media, Inc.
Published: 2016-07-14T16:00:00+00:00


Because Firmata is a serial protocol, you talk to the Arduino from Python in the same way as in previous examples, but using pyFirmata instead of pySerial. Use the write() method to make a digital pin high or low on the Arduino: from pyfirmata import Arduino from time import sleep board = Arduino('/dev/ttyACM0') while (1): board.digital[13].write(1) print("on") sleep(1) board.digital[13].write(0) print("off") sleep(1)

This code should blink the LED on the Arduino Uno board that is connected to pin 13. The full module is documented on the pyFirmata GitHub page.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.